package com.example.activitytest

import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.example.activitytest.databinding.ActivityThirdBinding

class ThirdActivity : AppCompatActivity() {
    private lateinit var binding: ActivityThirdBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityThirdBinding.inflate(layoutInflater)
        setContentView(binding.root)

        with(binding){
            tvExclaim.setOnClickListener{
                val intent = Intent()
                intent.putExtra("回传1","halo,second.from third")
                setResult(RESULT_OK,intent)//重要，用于将待回传的数据存到intent中，前一个参数一般都这么写，后面的intent参数是将本页面的数据回传到上一页面
                finish()//销毁本页面
            }

        }
    }
}